Hệ thống đặt hàng thực phẩm trong Php

1 <?php
2 include
'includes/connect.php';
3 include
'includes/wallet.php';
4
5     
if($_SESSION['customer_sid']==session_id())
6     {
7         ?>
8 <!DOCTYPE html>
9 <html lang=
"en">
10
11 <head>
12   <meta http-equiv=
"Content-Type" content="text/html; charset=UTF-8">
13   <meta name=
"viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
14   <meta http-equiv=
"X-UA-Compatible" content="IE=edge">
15   <meta name=
"msapplication-tap-highlight" content="no">
16   <title>Past Orders</title>
17
18   <!-- Favicons-->
19   <link rel=
"icon" href="images/favicon/favicon-32x32.png" sizes="32x32">
20   <!-- Favicons-->
21   <link rel=
"apple-touch-icon-precomposed" href="images/favicon/apple-touch-icon-152x152.png">
22   <!-- For iPhone -->
23   <meta name=
"msapplication-TileColor" content="#00bcd4">
24   <meta name=
"msapplication-TileImage" content="images/favicon/mstile-144x144.png">
25   <!-- For Windows Phone -->
26
27
28   <!-- CORE CSS-->
29   <link href=
"css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection">
30   <link href=
"css/style.min.css" type="text/css" rel="stylesheet" media="screen,projection">
31   <!-- Custome CSS-->
32   <link href=
"css/custom/custom.min.css" type="text/css" rel="stylesheet" media="screen,projection">
33
34   <!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
35   <link href=
"js/plugins/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet" media="screen,projection">
36   
37 </head>
38
39 <body>
40   <!-- Start Page Loading -->
41   <div id=
"loader-wrapper">
42       <div id=
"loader"></div>
43       <div
class="loader-section section-left"></div>
44       <div
class="loader-section section-right"></div>
45   </div>
46   <!-- End Page Loading -->
47
48   <!--
//////////////////////////////////////////////////////////////////////////// -->
49
50   <!-- START HEADER -->
51   <header id=
"header" class="page-topbar">
52         <!-- start header nav-->
53         <div
class="navbar-fixed">
54             <nav
class="navbar-color">
55                 <div
class="nav-wrapper">
56                     <ul
class="left">
57                       <li><h1
class="logo-wrapper"><a href="index.php" class="brand-logo darken-1"><img src="images/materialize-logo.png" alt="logo"></a> <span class="logo-text">Logo</span></h1></li>
58                     </ul>
59                     <ul
class="right hide-on-med-and-down">
60                         <li><a href=
"#" class="waves-effect waves-block waves-light"><i class="mdi-editor-attach-money"><?php echo $balance;?></i></a>
61                         </li>
62                     </ul>
63                 </div>
64             </nav>
65         </div>
66         <!-- end header nav-->
67   </header>
68   <!-- END HEADER -->
69
70   <!--
//////////////////////////////////////////////////////////////////////////// -->
71
72   <!-- START MAIN -->
73   <div id=
"main">
74     <!-- START WRAPPER -->
75     <div
class="wrapper">
76
77       <!-- START LEFT SIDEBAR NAV-->
78       <aside id=
"left-sidebar-nav">
79         <ul id=
"slide-out" class="side-nav fixed leftside-navigation">
80             <li
class="user-details cyan darken-2">
81             <div
class="row">
82                 <div
class="col col s4 m4 l4">
83                     <img src=
"images/avatar.jpg" alt="" class="circle responsive-img valign profile-image">
84                 </div>
85                 <div
class="col col s8 m8 l8">
86                     <ul id=
"profile-dropdown" class="dropdown-content">
87                         <li><a href=
"routers/logout.php"><i class="mdi-hardware-keyboard-tab"></i> Logout</a>
88                         </li>
89                     </ul>
90                 </div>
91                 <div
class="col col s8 m8 l8">
92                     <a
class="btn-flat dropdown-button waves-effect waves-light white-text profile-btn" href="#" data-activates="profile-dropdown"><?php echo $name;?> <i class="mdi-navigation-arrow-drop-down right"></i></a>
93                     <p
class="user-roal"><?php echo $role;?></p>
94                 </div>
95             </div>
96             </li>
97             <li
class="bold"><a href="index.php" class="waves-effect waves-cyan"><i class="mdi-editor-border-color"></i> Order Food</a>
98             </li>
99                 <li
class="no-padding">
100                     <ul
class="collapsible collapsible-accordion">
101                         <li
class="bold"><a class="collapsible-header waves-effect waves-cyan active"><i class="mdi-editor-insert-invitation"></i> Orders</a>
102                             <div
class="collapsible-body">
103                                 <ul>
104                                 <li
class="<?php
105                                 
if(!isset($_GET['status'])){
106                                         echo 'active';
107                                     }?>
108                                     "
><a href="orders.php">All Orders</a>
109                                 </li>
110                                 <?php
111                                     $sql = mysqli_query($con,
"SELECT DISTINCT status FROM orders WHERE customer_id = $user_id;;");
112                                     
while($row = mysqli_fetch_array($sql)){
113                                     
if(isset($_GET['status'])){
114                                         $status = $row[
'status'];
115                                     }
116                                     echo
'<li class='.(isset($_GET['status'])?($status == $_GET['status'] ? 'active' : ''): '').'><a href="orders.php?status='.$row['status'].'">'.$row['status'].'</a>
117                                     </li>
';
118                                     }
119                                     ?>
120                                 </ul>
121                             </div>
122                         </li>
123                     </ul>
124                 </li>
125                 <li
class="no-padding">
126                     <ul
class="collapsible collapsible-accordion">
127                         <li
class="bold"><a class="collapsible-header waves-effect waves-cyan"><i class="mdi-action-question-answer"></i> Tickets</a>
128                             <div
class="collapsible-body">
129                                 <ul>
130                                 <li><a href=
"tickets.php">All Tickets</a>
131                                 </li>
132                                 <?php
133                                     $sql = mysqli_query($con,
"SELECT DISTINCT status FROM tickets WHERE poster_id = $user_id AND not deleted;");
134                                     
while($row = mysqli_fetch_array($sql)){
135                                     echo
'<li><a href="tickets.php?status='.$row['status'].'">'.$row['status'].'</a>
136                                     </li>
';
137                                     }
138                                     ?>
139                                 </ul>
140                             </div>
141                         </li>
142                     </ul>
143                 </li>
144             <li
class="bold"><a href="details.php" class="waves-effect waves-cyan"><i class="mdi-social-person"></i> Edit Details</a>
145             </li>
146         </ul>
147         <a href=
"#" data-activates="slide-out" class="sidebar-collapse btn-floating btn-medium waves-effect waves-light hide-on-large-only cyan"><i class="mdi-navigation-menu"></i></a>
148         </aside>
149       <!-- END LEFT SIDEBAR NAV-->
150
151       <!--
//////////////////////////////////////////////////////////////////////////// -->
152
153       <!-- START CONTENT -->
154       <section id=
"content">
155
156         <!--breadcrumbs start-->
157         <div id=
"breadcrumbs-wrapper">
158           <div
class="container">
159             <div
class="row">
160               <div
class="col s12 m12 l12">
161                 <h5
class="breadcrumbs-title">Past Orders</h5>
162               </div>
163             </div>
164           </div>
165         </div>
166         <!--breadcrumbs end-->
167
168
169         <!--start container-->
170         <div
class="container">
171           <p
class="caption">List of your past orders with details</p>
172           <div
class="divider"></div>
173           <!--editableTable-->
174 <div id=
"work-collections" class="seaction">
175              
176                     <?php
177                     
if(isset($_GET['status'])){
178                         $status = $_GET[
'status'];
179                     }
180                     
else{
181                         $status =
'%';
182                     }
183                     $sql = mysqli_query($con,
"SELECT * FROM orders WHERE customer_id = $user_id AND status LIKE '$status';;");
184                     echo
' <div class="row">
185                 <div>
186                     <h4
class="header">List</h4>
187                     <ul id=
"issues-collection" class="collection">';
188                     
while($row = mysqli_fetch_array($sql))
189                     {
190                         $status = $row[
'status'];
191                         echo
'<li class="collection-item avatar">
192                               <i
class="mdi-content-content-paste red circle"></i>
193                               <span
class="collection-header">Order No. '.$row['id'].'</span>
194                               <p><strong>Date:</strong>
'.$row['date'].'</p>
195                               <p><strong>Payment Type:</strong>
'.$row['payment_type'].'</p>
196                               <p><strong>Address: </strong>
'.$row['address'].'</p>
197                               <p><strong>Status:</strong>
'.($status=='Paused' ? 'Paused <a data-position="bottom" data-delay="50" data-tooltip="Please contact administrator for further details." class="btn-floating waves-effect waves-light tooltipped cyan">    ?</a>' : $status).'</p>
198                               
'.(!empty($row['description']) ? '<p><strong>Note: </strong>'.$row['description'].'</p>' : '').'
199                               <a href=
"#" class="secondary-content"><i class="mdi-action-grade"></i></a>
200                               </li>
';
201                         $order_id = $row[
'id'];
202                         $sql1 = mysqli_query($con,
"SELECT * FROM order_details WHERE order_id = $order_id;");
203                         
while($row1 = mysqli_fetch_array($sql1))
204                         {
205                             $item_id = $row1[
'item_id'];
206                             $sql2 = mysqli_query($con,
"SELECT * FROM items WHERE id = $item_id;");
207                             
while($row2 = mysqli_fetch_array($sql2)){
208                                 $item_name = $row2[
'name'];
209                             }
210                             echo
'<li class="collection-item">
211                             <div
class="row">
212                             <div
class="col s7">
213                             <p
class="collections-title"><strong>#'.$row1['item_id'].'</strong> '.$item_name.'</p>
214                             </div>
215                             <div
class="col s2">
216                             <span>
'.$row1['quantity'].' Pieces</span>
217                             </div>
218                             <div
class="col s3">
219                             <span>Rs.
'.$row1['price'].'</span>
220                             </div>
221                             </div>
222                             </li>
';
223                             $id = $row1[
'order_id'];
224                         }
225                                 echo
'<li class="collection-item">
226                                         <div
class="row">
227                                             <div
class="col s7">
228                                                 <p
class="collections-title"> Total</p>
229                                             </div>
230                                             <div
class="col s2">
231                                             <span> </span>
232                                             </div>
233                                             <div
class="col s3">
234                                                 <span><strong>Rs.
'.$row['total'].'</strong></span>
235                                             </div>
';
236                                 
if(!preg_match('/^Cancelled/', $status)){
237                                     
if($status != 'Delivered'){
238                                 echo
'<form action="routers/cancel-order.php" method="post">
239                                         <input type=
"hidden" value="'.$id.'" name="id">
240                                         <input type=
"hidden" value="Cancelled by Customer" name="status">
241                                         <input type=
"hidden" value="'.$row['payment_type'].'" name="payment_type">
242                                         <button
class="btn waves-effect waves-light right submit" type="submit" name="action">Cancel Order
243                                               <i
class="mdi-content-clear right"></i>
244                                         </button>
245                                         </form>
';
246                                 }
247                                 }
248                                 echo
'</div></li>';
249
250                     }
251                     ?>
252                      </ul>
253                 </div>
254               </div>
255             </div>
256         </div>
257         <!--end container-->
258
259       </section>
260       <!-- END CONTENT -->
261     </div>
262     <!-- END WRAPPER -->
263
264   </div>
265   <!-- END MAIN -->
266
267
268
269   <!--
//////////////////////////////////////////////////////////////////////////// -->
270
271   <!-- START FOOTER -->
272   <footer
class="page-footer">
273     <div
class="footer-copyright">
274       <div
class="container">
275         <span>Copyright ©
2017 <a class="grey-text text-lighten-4" href="#" target="_blank">Students</a> All rights reserved.</span>
276         <span
class="right"> Design and Developed by <a class="grey-text text-lighten-4" href="#">Students</a></span>
277         </div>
278     </div>
279   </footer>
280     <!-- END FOOTER -->
281
282
283
284     <!-- ================================================
285     Scripts
286     ================================================ -->
287     
288     <!-- jQuery Library -->
289     <script type=
"text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
290     <!--angularjs-->
291     <script type=
"text/javascript" src="js/plugins/angular.min.js"></script>
292     <!--materialize js-->
293     <script type=
"text/javascript" src="js/materialize.min.js"></script>
294     <!--scrollbar-->
295     <script type=
"text/javascript" src="js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
296     <!--plugins.js - Some Specific JS codes
for Plugin Settings-->
297     <script type=
"text/javascript" src="js/plugins.min.js"></script>
298     <!--custom-script.js - Add your own theme custom JS-->
299     <script type=
"text/javascript" src="js/custom-script.js"></script>
300 </body>
301
302 </html>
303 <?php
304     }
305     
else
306     {
307         
if($_SESSION['admin_sid']==session_id())
308         {
309             header(
"location:all-orders.php");
310         }
311         
else{
312             header(
"location:login.php");
313         }
314     }
315 ?>


Gõ tìm kiếm nhanh...